package com.itheima.dateutil;

import java.text.ParseException;
import java.util.Date;

public class Demo_Date {
    public static void main(String[] args) throws ParseException {
        Date date = new Date();
        String s = MyDateUtil.dateToString(date);
        System.out.println(s);
        System.out.println("---------------------");
        String s1 = MyDateUtil.dateToString(date, "yyyy/MM/dd HH:mm:ss");
        System.out.println(s1);
        System.out.println("---------------------");
        String a = "2020-11-11 00:00:00";
        Date date1 = MyDateUtil.stringToDate(a);
        System.out.println(date1);
        System.out.println("---------------------");
        Date date2 = MyDateUtil.stringToDate(a,"yyyy-MM-dd HH:mm:ss");
        System.out.println(date2);
        System.out.println("---------------------");
        long b1 = MyDateUtil.millisecondBetween(date1, date);
        System.out.println(b1);
        System.out.println("---------------------");
        long b2 = MyDateUtil.daysBetween(date1, date);
        System.out.println(b2);

    }
}
